<?php
session_start();
//ini_set ("display_errors", "1");
error_reporting(E_ALL^ E_NOTICE);
//error_reporting(E_ALL ^ E_NOTICE);
include( 'config.php' );


//require_once( PARAM_CLASS.'class.HackerConsole.php');
//new Debug_HackerConsole_Main( PARAM_DEBAG_STATUS );

include_once( PARAM_CLASS.'class.FastTemplate.php' );
$GLOBALS['tpl'] = new FastTemplate( PARAM_TEMPL );

include_once( PARAM_CLASS.'class.datasource.php' );
$modules=new Tdatasource('modules');
$_REQUEST['mdl']=$_REQUEST['mdl']?$_REQUEST['mdl']:'articles';
$GLOBALS['tpl']->assign( array(	'PAGE_TITLE'        => 'Клуб подводников "Атлантида - КПИ"',
                                'PATH_CSS'          => PARAM_PATH_CSS,
                                'PATH_WWW'          => PARAM_PATH_WWW,
                                'PARAM_MODULES'     => PARAM_PATH_MODULES,
                                'PATH_IMG'          => PARAM_PATH_IMG,
                                'PATH_JS'           => PARAM_PATH_JS,
                                'PATH_PHOTOS'       => PARAM_PATH_PHOTOS,
                                'MODULE'            => $_REQUEST['mdl']));

$GLOBALS['tpl']->define( array(	'header'            => 'header.html',
                                'footer'            => 'footer.html',
                                'body'              => 'body.html',
                                'menu_item'         => 'menu_item.html'));

$GLOBALS['tpl']->parse( 'HEADER', 'header' );
$GLOBALS['tpl']->FastPrint( 'HEADER' );

if($modules->select(' `hidden`=0 and `parent`=0'))do
{
    $GLOBALS['tpl']->assign( array(	'MENU_ITEM_NAME'        => $modules->values['name'],
                                        'MENU_ITEM_RU_NAME'     => $modules->values['ru_name'],
                                        'ACTIVE'                => ($modules->values['name']==$_REQUEST['mdl'])?'active':''));
    $GLOBALS['tpl']->parse( 'MENU_ITEMS', '.menu_item');
}while($modules->next());


include (PARAM_MODULES.$_REQUEST['mdl'].'/index.php');

$GLOBALS['tpl']->parse( 'BODY', 'body');
$GLOBALS['tpl']->FastPrint( 'BODY' );

$GLOBALS['tpl']->parse( 'FOOTER', 'footer');
$GLOBALS['tpl']->FastPrint( 'FOOTER' );

exit;
?>
